using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Stratman.Web.VSTS
{
    /// <summary>
    /// Contains the various settings to control the behavior of the timesheet application.
    /// </summary>
    public class TimesheetSettings : ConfigurationSection
    {
        /// <summary>
        /// Switch indicating whether or not we should enforce consistency.  If this is enabled,
        /// we make sure that the hours entered by the user in their timesheet are consistent
        /// with the hours allocated to the completed hours field.  If they are not consistent,
        /// we display a message to the user.  If this is disabled, users can enter time without
        /// any correlation to the actual values for a work item.
        /// </summary>
        [ConfigurationProperty("enforceConsistency")]
        public EnabledDisabledConfigurationElement EnforceConsistency
        {
            get
            {
                return (EnabledDisabledConfigurationElement)base["enforceConsistency"];
            }
        }

        /// <summary>
        /// Switch indicating whether we should synchronize completed/remaining hours values for a
        /// work item with changes made to the timesheet.  If this is enabled, we will take the
        /// total change in hours for a work item made in the timesheet, add it to the completed
        /// hours field in the actual work item, and subtract it from the remaining hours field.
        /// </summary>
        [ConfigurationProperty("updateWorkItemsFromTimesheet")]
        public EnabledDisabledConfigurationElement UpdateWorkItemsFromTimesheet
        {
            get
            {
                return (EnabledDisabledConfigurationElement)base["updateWorkItemsFromTimesheet"];
            }
        }

        /// <summary>
        /// Contains data concerning the various types of time being captured for this project.
        /// </summary>
        [ConfigurationProperty("timeAmounts")]
        public TimeAmountCollection TimeAmounts
        {
            get
            {
                return (TimeAmountCollection)base["timeAmounts"];
            }
        }

        /// <summary>
        /// Contains the list of users who are to be given administrative privledges.
        /// </summary>
        [ConfigurationProperty("administrators")]
        public TimesheetAdministratorCollection Administrators
        {
            get
            {
                return (TimesheetAdministratorCollection)base["administrators"];
            }
        }
    }
}
